import request from "@/utils/request";

export function publish(method, data) {
  if (method == "post") {
    return request({
      url: "/mqtt/publish",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/mqtt/publish",
      method: method,
      params: data,
    });
  }
}
export function areaonoff(method, data) {
  if (method == "post") {
    return request({
      url: "/mqtt/areaonoff",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/mqtt/areaonoff",
      method: method,
      params: data,
    });
  }
}
export function devstatus(method, data) {
  if (method == "post") {
    return request({
      url: "/mqtt/devstatus",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/mqtt/devstatus",
      method: method,
      params: data,
    });
  }
}
export function deviceonoff(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/deviceonoff",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/deviceonoff",
      method: method,
      params: data,
    });
  }
}
export function roomcontrol(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/roomcontrol",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/roomcontrol",
      method: method,
      params: data,
    });
  }
}

export function iotsetmodel(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/setmodel",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/setmodel",
      method: method,
      params: data,
    });
  }
}

//更新区域
export function updatearea(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/area",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/area",
      method: method,
      params: data,
    });
  }
}

//更新设备
export function updatedevicelist(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/devicelist",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/devicelist",
      method: method,
      params: data,
    });
  }
}

//修改设备修改够更新 type 1 2 
export function updatemodel(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/model",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/model",
      method: method,
      params: data,
    });
  }
}



//设备开关 1 2 type 1 2 
export function updateexecute(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/execute",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/execute",
      method: method,
      params: data,
    });
  }
}


//设备开关 1 2 type 1 2 
export function updatemodify(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/modify",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/modify",
      method: method,
      params: data,
    });
  }
}



